package main

import (
	"fmt"
	"gorm-study/src/pkg/student/models"
	"gorm-study/src/pkg/utils/dbutil"
)

func main() {
	var count int64
	dbutil.DB.Model(&models.Student{}).Where("gender = ?", false).Count(&count)
	fmt.Printf("删除前查询 gender 为 false 的记录，数量：%v \n", count)

	deleteResult := dbutil.DB.Where("gender = ?", false).Delete(&models.Student{})
	fmt.Printf("删除条数：%v \n", deleteResult.RowsAffected)

	dbutil.DB.Model(&models.Student{}).Where("gender = ?", false).Count(&count)
	fmt.Printf("删除后查询 gender 为 false 的记录，数量：%v \n", count)
}
